package com.inspur.icity.bus.base.core.model;




import com.inspur.icity.bus.base.core.util.JacksonUtil;

import java.util.Set;

/**
 * 用户Session信息，包括用户信息、登录状态、权限列表
 */
public class UserSessionInfo implements AliasModel {
    Long userId;
    Long orgId;
    String userName;
    String orgName;
    boolean isLogin;
    Set<String> permissions;

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public boolean isLogin() {
        return isLogin;
    }

    public void setLogin(boolean isLogin) {
        this.isLogin = isLogin;
    }

    public Set<String> getPermissions() {
        return permissions;
    }

    public void setPermissions(Set<String> permissions) {
        this.permissions = permissions;
    }

    @Override
    public String toString() {
        return "UserInfo{" +
                "userId=" + userId +
                ", orgId=" + orgId +
                ", userName='" + userName + '\'' +
                ", orgName='" + orgName + '\'' +
                ", isLogin=" + isLogin +
                ", permissions=" + permissions +
                '}';
    }

    public String toJson() {
        return JacksonUtil.toJson(this);
    }
}
